<?php 
	$user_id = Helper_Auth::instance()->get_user_id();
	$owner = NULL;
	for($i = 0; $i < count($milestone['users']); $i++)
	{
		if ($milestone['users'][$i]['is_key'])
		{
			$owner = $milestone['users'][$i];
			break;
		}
	}
?>
<form action="/ajax_milestone/edit_milestone/<?php echo $milestone['id']?>" method="post" class="add-milestone">
	<div class="balloon-pointer">
		<div class="balloon-arrow"></div>
		<div class="balloon-arrow-border"></div>
   	    </div>
		<div class="balloon-content">
			<div class="part">
			<label>Title :</label>
				<input type="text" name="name" value="<?php echo $milestone['name']?>">
			</div>	
			<div class="part">
				<label>Deadline :</label>
				<input type="text" class="deadline" name="deadline" value="<?php echo $milestone['deadline']?>"> at
				<input type="hidden" class="old-deadline" name="old-deadline" value="<?php echo $milestone['deadline']?>">
				<input type="text" class="time" name="time" value="<?php echo $milestone['time']?>">
			</div>
			<div class="part">
				<label>Owner :</label>
				<select name="owner_id">
					<?php foreach ($users as $u):?>
					<option <?php if ($u['id'] == $owner['user_id']) echo 'checked';?>value="<?php echo $u['id']?>"><?php echo $u['displayname']?></option>
					<?php endforeach;?>
				</select>
				<input type="text" name="owner_id" value="<?php echo $milestone['user_id']?>">
			</div>
			<div class="part">
				<label>Description :</label>
				<textarea name="description"><?php echo $milestone['description']?></textarea>
			</div>
			<div class="part final">
			<button class="cancel left">Cancel</button>
			<button class="save left">Save</button>	
		</div>
		<input type="hidden" name="cur_user_id" value="<?php echo $user_id?>">		
		<input type="hidden" name="project_id" value="<?php echo $milestone['project_id']?>">
	</div>
</form>